#!/bin/bash
start_time=$(date +%s)
sync; echo 3 | sudo tee /proc/sys/vm/drop_caches
sudo ./scripts/load_one.sh 562950190869089.csv & sudo ./scripts/load_one.sh 562949971777756.csv & 
wait
echo load完成

sync; echo 3 | sudo tee /proc/sys/vm/drop_caches
sudo ./scripts/run_lsm_one.sh 562950190869089.csv & sudo ./scripts/run_lsm_one.sh 562949971777756.csv & 
wait
echo run_lsm完成

sync; echo 3 | sudo tee /proc/sys/vm/drop_caches
sudo ./scripts/load_one.sh 562950190869089.csv & sudo ./scripts/load_one.sh 562949971777756.csv & 
wait
echo load完成

sync; echo 3 | sudo tee /proc/sys/vm/drop_caches
sudo ./scripts/run_baseline_one.sh 562950190869089.csv & sudo ./scripts/run_baseline_one.sh 562949971777756.csv & 
wait
echo run_baseline完成

# 下面的是统计性能，fork自all_trace.sh
path=../data/ebs_segment_io_records/AY283G_2022-01-01_00:00:00_2022-01-02_00:00:00/device/
for filename in 562950190869089.csv 562949971777756.csv ; do
  data_path=${path}${filename}
  data_name=${filename%.*}
  for executable_file in trace_allPut trace_realRun ; do
    cd ../learned-leveldb/
    python ./scripts/collect_results.py 1 ${data_name}_${executable_file}_16 > ../evaluation/expr_${data_name}_${executable_file}_16.txt
    cat ../evaluation/expr_${data_name}_${executable_file}_16.txt
  done
done

# 结束，统计时间
end_time=$(date +%s)
cost_time=$((end_time-start_time))
echo "$0" "运行时间：$((cost_time/60))min $((cost_time%60))s"
